<?php 
phpinfo();
$servername = "localhost";
$username = "root";
$password = "1234";
$myDb = "mzwh";
?>

<?php
 
// 创建连接
$conn = new mysqli($servername, $username, $password, $myDb);
 
// 检测连接
if ($conn->connect_error) {
    die("连接失败: " . $conn->connect_error);
} 
echo "连接成功";

$sql = "SELECT name, department, email FROM mz_user";
$result = $conn->query($sql);
 
if ($result->num_rows > 0) {
    // 输出数据
    while($row = $result->fetch_assoc()) {
        echo "name: " . $row["name"]. " - department: " . $row["department"]. " " . $row["email"]. "<br>";
    }
} else {
    echo "0 结果";
}

$conn->close();

?>

<?php 
	//phpinfo();

	echo $_SERVER;
?>